package com.ht.medicaltreatment.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.ht.medicaltreatment.R
import com.ht.medicaltreatment.bean.Page

class HaoCaiListAdapter : BaseQuickAdapter<Page,BaseViewHolder>(R.layout.item_haocai_layout) {

    private var auth  = 0

    fun setAuthSign(auth:Int){
        this.auth = auth
    }

    init {
        addChildClickViewIds(R.id.tvDelete,R.id.tvChange,R.id.tvName,R.id.tvStatus)
    }

    override fun convert(holder: BaseViewHolder, item: Page) {
        holder.setText(R.id.tvCode,"${getItemPosition(item)+1}")
        holder.setText(R.id.tvName,item.protocolNumber)
        holder.setText(R.id.tvStatus,item.consumableUseProgress)
        if(auth == 0){
            holder.setGone(R.id.tvDelete,false)
            holder.setGone(R.id.tvChange,true)
        }else if(auth == 1){
            holder.setGone(R.id.tvChange,false)
            holder.setGone(R.id.tvDelete,false)
        }
    }
}
